package cn.wolfcode.utils;

import cn.wolfcode.domain.Employee;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.crypto.hash.Md5Hash;
import org.apache.shiro.subject.Subject;

/**
 * @author 杨兴健
 * @Date 2020/7/19 20:18
 * <p>
 * 给用户密码加密加盐
 */
public class PasswordUtil {
    public static void setMD5HashPassword(Employee employee) {

        Md5Hash md5Hash = new Md5Hash(employee.getPassword(), employee.getName(), 2);
        employee.setPassword(md5Hash.toHex());
    }

    public static void setMD5HashPassword(Employee employee, String newPassword) {

        Md5Hash md5Hash = new Md5Hash(newPassword, employee.getName(), 2);
        employee.setPassword(md5Hash.toHex());
    }

}
